package cn.itsource.xhy.org.service.impl;

import cn.itsource.xhy.basic.query.BaseQuery;
import cn.itsource.xhy.org.domain.SystemDetall;
import cn.itsource.xhy.org.mapper.SystemDetallMapper;
import cn.itsource.xhy.org.query.SystemDetallQuery;
import cn.itsource.xhy.org.service.ISystemDetallService;
import cn.itsource.xhy.utils.QueryResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class SystemDetallServiceImpl implements ISystemDetallService {

    @Autowired
    private SystemDetallMapper systemDetallMapper;

    @Override
    @Transactional
    public void save(SystemDetall systemDetall) {
        systemDetallMapper.save(systemDetall);
    }

    @Override
    @Transactional
    public void update(SystemDetall systemDetall) {
        systemDetallMapper.update(systemDetall);
    }

    @Override
    @Transactional
    public void del(Long id) {
        systemDetallMapper.del(id);
    }

    @Override
    public SystemDetall findById(Long id) {
        return systemDetallMapper.findById(id);
    }

    @Override
    public List<SystemDetall> findAll() {
        return systemDetallMapper.findAll();
    }

    @Override
    public QueryResult<SystemDetall> queryPage(SystemDetallQuery query) {
        Long total = systemDetallMapper.count(query);
        if (total==null||total == 0){
            return new QueryResult<>();
        }
        List<SystemDetall> data = systemDetallMapper.queryPage(query);
        return new QueryResult<>(data,total);
    }

    @Override
    @Transactional
    public void patchDel(Long[] ids) {
        systemDetallMapper.patchDel(ids);
    }

}
